<h1>Edit Category</h1>
<?php
	echo $this->Form->create('Category', array('id' => 'edit_category_form'));
	echo $this->Form->input('id', array('type' => 'hidden'));
	echo $this->Form->input('name');
?>

<table class="sub_cat_table">
	<thead>
		<tr>
			<th colspan="2">Sous-catégories</th>
		</tr>
	</thead>
	
	<tbody>
	<?php 
		foreach($sub_categories as $subcat):
	?>
		<tr>
			<td><?php echo $this->Form->input('Children.0.name', array('label' => false, 'value' => $subcat['name']))?></td>
			<td class="remove_sub_cat"><span class="button">-</span></td>
		</tr>
	<?php endforeach;?>
		<tr id="new_sub_cat">
			<td><?php echo $this->Form->input('Children.0.name', array('label' => false, 'required' => false, 'value' => ''))?></td>
			<td class="remove_sub_cat"><span class="button">-</span></td>
		</tr>
		<tr>
			<td id="add_sub_cat" colspan="2"><span class="button">+</span></td>
		</tr>
	</tbody>
</table>

<?php
	echo $this->Form->input('description');
	echo $this->Form->submit('Valider', array('class' => 'button'));
    echo $this->Form->end();
?>